<%@ page import="dart.Classification" %>
<% classes = Classification.findAllByEnabled(true, [sort: "scoreMultiplier", order: "asc"])

classNames = classes.collect { it.name }
classIds = classes.collect {it.id}
classDefault = 0

multNames = ['Triple', 'Double', 'Single', 'Miss', 'Penalty']
multVals = [3, 2, 1, 0, -1]
multDefault = 1

penaltyNames = ["Bounce Out", "Small", "Large", "Permanent"]
penaltyKeys = [1, 5, 10, 20]
penaltyDefault = 5

attemptRange = 0..<(attempts.toInteger())
%>

<g:each in="${attemptRange}" var="num">
	<% sel = "attempt[$num]" %>
	<tr>
		<td>Throw ${num + 1}</td>
		<td id="classCell${num}">
			<g:radioGroup name="${sel}.classification" labels="${classNames}"
					values="${classIds}" value="${classDefault}">
				<label onChange="classification.change(${num});">${it.radio} ${it.label}</label> <br>
			</g:radioGroup>
		</td>
		<td id="multiplierCell${num}" class="multiplier">
			<g:radioGroup name="${sel}.multiplier" labels="${multNames}"
					values="${multVals}" value="${multDefault}">
				<label onChange="multiplier.change(${num});">${it.radio} <span>${it.label}</span></label><br>
			</g:radioGroup>
		</td>
		<td id="valueCell${num}" class="attempt" align="center">
			<br>
			<g:textField tabindex="${num+1}" name="${sel}.value"
					onChange="attempt.change(${num})" class="error"/>
			<span id="valueText${num}"></span>&nbsp;
		</td>
		<td class="score">
			<span id="score${num}">0</span>
		</td>
	</tr>
</g:each>